<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>登录</title>
<style>
.back{
    background-image: url(img/登录背景.jpg)
}
</style>
</head>
<body class="back">
<div style="width:320px;height:400px;margin:auto;margin-top:20%">
    <h1>登录</h1>
    <p>用户名：
        <input id="username" type="text" name="username" valus="">
    </p>
    <p>密码：
        <input id="password" type="text" name="password" valus="">
    </p><br>
    <button style="margin-left:30px" type="button" onclick="check('');">登录</button>
    <button style="margin-left:80px" type="button" onclick="window.location.href='file:///G:/java%20web/%E5%AE%9E%E8%AE%AD/%E6%B3%A8%E5%86%8C.html'">注册</button><br>
</div>
<script>
function check(){
    if(username.value=="123" && password.value=="123"){
    // window.location.href="http://www.baidu.com/";
        alert("登录成功！");
    }
    else if(username.value=="" || password.value==""){
        alert("用户名或密码不能为空！");
    }
    else{
        alert("用户名或密码出错！");
        password.value="";
    }
}
</script>
</body>
</html>